<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <script src="./echarts.min.js"></script>
    <style>
      #main {
        border: 5px solid rgba(255, 0, 0, 0.5);
        margin: 100px auto;
      }
    </style>
  </head>
  <body>
    <!-- 为 ECharts 准备一个定义了宽高的 DOM -->
    <div id="main" style="width: 600px; height: 400px"></div>
    <script type="text/javascript">
      // 基于准备好的dom，初始化echarts实例
      var myChart = echarts.init(document.getElementById("main"));

      option = {
        title: [
          {
            text: "男女薪资分布图",
            left: "5%",
            top: "2%",
          },
          {
            subtext: "男生",
            left: "center",
            top: "42%",
            subtextStyle: {
              fontWeight: "700",
              fontSize: "20",
            },
          },

          {
            subtext: "女生",
            left: "center",
            top: "90%",
            subtextStyle: {
              fontWeight: "700",
              fontSize: "20",
            },
          },
        ],
        series: [
          {
            type: "pie",
            radius: ["25%", "35%"],
            center: ["50%", "25%"],
            data: [
              {
                name: "1-1.5万",
                value: 70,
              },
              {
                name: "1.5-2万",
                value: 68,
              },
              {
                name: "2万以上",
                value: 48,
              },
              {
                name: "1万以下",
                value: 40,
              },
            ],
            label: {
              position: "outer",
              alignTo: "none",
              bleedMargin: 5,
            },
          },
          {
            type: "pie",
            radius: ["25%", "35%"],
            center: ["50%", "70%"],
            data: [
              {
                name: "1-1.5万",
                value: 70,
              },
              {
                name: "1.5-2万",
                value: 68,
              },
              {
                name: "2万以上",
                value: 48,
              },
              {
                name: "1万以下",
                value: 40,
              },
            ],
            label: {
              position: "outer",
              alignTo: "labelLine",
              bleedMargin: 5,
            },
          },
        ],
      };
      // 使用刚指定的配置项和数据显示图表。
      myChart.setOption(option);
    </script>
  </body>
</html>
